﻿using System;
using System.Windows.Forms;

using SampleApplication.model;

namespace SampleApplication.view
{
    public partial class LoginView : Form, ILoginView
    {
        public event EventHandler Login;
        public event EventHandler Reset;

        public LoginView()
        {
            InitializeComponent();
            Login += delegate { };
            Reset += delegate { };
        }

        public Principal Principal
        {
            get
            {
                var source = principalBindingSource.DataSource;
                return (Principal) source;
            }
            set { principalBindingSource.DataSource = value; }
        }

        public void DisplayView()
        {
            Show();
        }

        public void CloseView()
        {
            Close();
        }

        private void loginButton_Click(object sender, EventArgs e)
        {
            Login(sender, e);
        }

        private void reset_Click(object sender, EventArgs e)
        {
            Reset(sender, e);
        }
    }
}